package org.jeecg.modules.flowable.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.flowable.dto.FlowInstanceStartDTO;
import org.jeecg.modules.flowable.dto.FlowInstanceStopDTO;
import org.jeecg.modules.flowable.entity.FlowInstance;
import org.jeecg.modules.flowable.enums.FlowInstanceStatusEnum;
import org.jeecg.modules.flowable.vo.FlowInstanceVO;

public interface FlowInstanceService extends IService<FlowInstance> {

    /**
     * 开启流程实例
     */
    Result<Void> start(FlowInstanceStartDTO dto);


    /**
     * 关闭流程实例
     */
    Result<Void> stop(FlowInstanceStopDTO dto);

    /**
     * 更新流程实例状态
     */
    void updateInstanceStatus(String processInstanceId, FlowInstanceStatusEnum status);

    FlowInstance getInstanceByBusinessDataId(String businessKey, String businessDataId);

    /**
     * 流程实例信息
     */
    Result<FlowInstanceVO> info(String instanceId);

    FlowInstance searchByBusinessKeyAndBusinessDataId(String businessKey, String businessDataId);
}
